home *** CD-ROM | disk | FTP | other *** search
/ Amiga Developer CD 2.1 / Amiga Developer CD v2.1.iso / Reference / DevCon / Washington_1988 / DevCon88.3 / Printer / src / Okimate20 / dospecial.c < prev    next >
Encoding:
C/C++ Source or Header  |  1992-08-27  |  2.4 KB  |  126 lines

  1. /*
  2.     DoSpecial for Okimate-20 driver.
  3.     David Berezowski - March/88.
  4.  
  5.   Copyright (c) 1988 Commodore-Amiga, Inc.
  6.  
  7.   Executables based on this information may be used in software
  8.   for Commodore Amiga computers.  All other rights reserved.
  9.  
  10.   This information is provided "as is"; no warranties are made.
  11.   All use is at your own risk, and no liability or responsibility is assumed.
  12. */
  13.  
  14.  
  15. #include "exec/types.h"
  16. #include "../printer/printer.h"
  17. #include "../printer/prtbase.h"
  18.  
  19. DoSpecial(command, outputBuffer, vline, currentVMI, crlfFlag, Parms)
  20. char outputBuffer[];
  21. UWORD *command;
  22. BYTE *vline;
  23. BYTE *currentVMI;
  24. BYTE *crlfFlag;
  25. UBYTE Parms[];
  26. {
  27.     extern struct PrinterData *PD;
  28.     extern struct PrinterExtendedData *PED;
  29.  
  30.     int x = 0, i = 0;
  31.     static char initThisPrinter[] =
  32.         "\033I\001\022\0330\033%H\033-\376\015\033W";
  33.     static BYTE ISOcolTable[10] = {2, 1, 0, 0, 2, 1, 2, 0, 2, 2};
  34.  
  35.     if (*command == aRIN) {
  36.         while(x < 15) {
  37.             outputBuffer[x] = initThisPrinter[x];
  38.             x++;
  39.         }
  40.         outputBuffer[11] = '\000';
  41.         outputBuffer[x++] = '\000';
  42.  
  43.         if (PD->pd_Preferences.PrintQuality == LETTER) {
  44.             outputBuffer[2] = '\002';
  45.         }
  46.  
  47.         if (PD->pd_Preferences.PrintPitch == ELITE) {
  48.             outputBuffer[x++] = '\033';
  49.             outputBuffer[x++] = ':';
  50.         }
  51.         else if (PD->pd_Preferences.PrintPitch == FINE) {
  52.             outputBuffer[x++] = '\017';
  53.         }
  54.  
  55.         *currentVMI = 27; /* assume 8 lpi (27/216 = 1/8) */
  56.         if (PD->pd_Preferences.PrintSpacing == SIX_LPI) {
  57.             outputBuffer[x++] = '\033';
  58.             outputBuffer[x++] = 'A';
  59.             outputBuffer[x++] = '\014';
  60.             outputBuffer[x++] = '\033';
  61.             outputBuffer[x++] = '2';
  62.             *currentVMI = 36; /* 36/216 = 1/6 */
  63.         }
  64.         return(x);
  65.     }
  66.  
  67.     if (*command == aNEL) {
  68.         outputBuffer[x++] = '\015';
  69.         outputBuffer[x++] = '\012';
  70.         return(x);
  71.     }
  72.  
  73.     if (*command == aPLU) {
  74.         if (*vline == 0) {
  75.             *vline = 1;
  76.             *command = aSUS2;
  77.             return(0);
  78.         }
  79.         if (*vline < 0) {
  80.             *vline = 0;
  81.             *command = aSUS3;
  82.             return(0);
  83.         }
  84.         return(-1);
  85.     }
  86.  
  87.     if (*command == aPLD) {
  88.         if (*vline == 0) {
  89.             *vline = -1;
  90.             *command = aSUS4;
  91.             return(0);
  92.         }
  93.         if (*vline > 0) {
  94.             *vline = 0;
  95.             *command = aSUS1;
  96.             return(0);
  97.         }
  98.         return(-1);
  99.     }    
  100.  
  101.     if (*command == aSUS0) {
  102.         *vline = 0;
  103.     }
  104.     if (*command == aSUS1) {
  105.         *vline = 0;
  106.     }
  107.     if (*command == aSUS2) {
  108.         *vline = 1;
  109.     }
  110.     if (*command == aSUS3) {
  111.         *vline = 0;
  112.     }
  113.     if (*command == aSUS4) {
  114.         *vline = -1;
  115.     }
  116.  
  117.     if (*command == aVERP0) {
  118.         *currentVMI = 27;
  119.     }
  120.     if (*command == aVERP1) {
  121.         *currentVMI = 36;
  122.     }
  123.  
  124.     return(0);
  125. }
  126.